<%@ page import="com.cmq.web_1.user_register.User" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>操作成功</title>
    <style>
        body { font-family: Arial, sans-serif; max-width: 500px; margin: 0 auto; padding: 20px; }
        .success { color: green; }
        a { color: #4CAF50; text-decoration: none; }
        a:hover { text-decoration: underline; }
    </style>
</head>
<body>
<h1 class="success">注册/登录成功！</h1>

<%
    // 从request或Session中获取用户信息（注册成功从request，登录成功从Session）
    User user = (User) request.getAttribute("user");
    if (user == null) {
        user = (User) session.getAttribute("user");
    }
    if (user != null) {
%>
<p>欢迎，<%= user.getUsername() %>！</p>
<p>您的邮箱是：<%= user.getEmail() %></p>
<%
    }
%>

<p><a href="${pageContext.request.contextPath}/login?action=logout">退出登录</a></p>
</body>
</html>